<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'people.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
    This is my JSP page. <br>
    
	<%request.setCharacterEncoding("UTF-8");  %>
	  <%!
	  int count;
	  StringBuffer person;
	  public void judge(){
		  if(count==0)
			 person=new StringBuffer();  /* 创建对象  */
	  }
	  public void addPerson(String p){
		  if(count==0)
			  person.append(p);  /*append为追加字符串在末尾*/
		  else
			  person.append(','+p);
		  count++;
	  }
	  %>
	  数据接收
	  <%String name=request.getParameter("rdName");
	  if(name==null || name.length()==0||name.length()>10){
	  %>
	  <jsp:forward page="inputName.jsp">
	     <jsp:param value="请输入长度大于0且长度小于等于10的名称" name="mess"/>
	  </jsp:forward>
	  <% }
	  
       judge();
       addPerson(name);
	  %>
	  <br>目前有<font color="blue" size='5'><%=count %></font>人浏览了该页面.
	  <hr color="red">
      <br>姓名分别为：<%=person %>
      <br>
      <% out.print("<a href='javascript:history.back()'>返回</a> ");%>
  </body>
</html>
